<%@ page import="java.sql.Connection" %>
<%@ page import="java.sql.PreparedStatement" %>
<%@ page import="java.sql.ResultSet" %>
<%@ page import="com.example.demo2.DBUtil" %>
<%@ page language="java" contentType="text/html; charset=UTF-8"
		 pageEncoding="UTF-8"%>



			<div>
				<%
					String r_pinp = request.getParameter("pinp");
					String r_xzq = request.getParameter("xzq");
					String r_leix = request.getParameter("leix");
					String r_fuw = request.getParameter("fuw");

					cn = DBUtil.getConnection();
					sql = "select * from cinema ";
					ps = cn.prepareStatement(sql);
					if (r_pinp !=null){
						sql = sql + "WHERE pinp=?";
						ps = cn.prepareStatement(sql);
						ps.setString(1, r_pinp);
					}
					if (r_xzq !=null){
						sql = sql + "WHERE xzq=?";
						ps = cn.prepareStatement(sql);
						ps.setString(1, r_xzq);
					}
					if (r_leix !=null){
						sql = sql + "WHERE leix=?";
						ps = cn.prepareStatement(sql);
						ps.setString(1, r_leix);
					}
					if (r_fuw !=null){
						sql = sql + "WHERE fuw LIKE\"%"+r_fuw+"%\";";
//						System.out.println(sql);
						ps = cn.prepareStatement(sql);
					}
				%>
				<div style="height: 1px"></div>
				<div class="z1" style="margin-top: 8%;">

					<div class="z1-1">
						品牌：
						<%
							String[] name2 = new String[]{"全部","万达影城","百老汇影城","环球影城","万象影城"};
							for (int i = 0;i<name2.length;i++){
						%>
							<a
								style="margin: 0 20px"
								href="yingyuan.jsp<%=name2[i] == "全部"?"":"?pinp="+name2[i]%>"
								<%
									if (name2[i].equals(r_pinp)){
								%>
						   			class="active"
								<%
									} else if (name2[i].equals("全部")) {
										if (r_pinp == null){

								%>
								class="active"
								<%
										}
									}
								%>
						><%=name2[i]%></a>
						<%
							}
						%>
					</div>

					<div class="z1-2">
						行政区：
						<%
							String[] xzq2 = new String[]{"全部","地铁附近","朝阳区","海淀区","丰台区","昌平区","通州区"};
							for (int i = 0;i<xzq2.length;i++){
						%>
						<a
								href="yingyuan.jsp<%=xzq2[i] == "全部"?"":"?xzq="+xzq2[i]%>"
								style="margin: 0 20px"
								<%
									if (xzq2[i].equals(r_xzq)){
								%>
								class="active"
								<%
								} else if (xzq2[i].equals("全部")) {
									if (r_xzq == null){

								%>
								class="active"
								<%
										}
									}
								%>
						><%=xzq2[i]%></a>
						<%
							}
						%>
					</div>

					<div class="z1-3">
						影厅类型：
						<%
							String[] leix2 = new String[]{"全部","IMAX厅","4K厅","4D厅"};
							for (int i = 0;i<leix2.length;i++){
						%>
						<a
								href="yingyuan.jsp<%=leix2[i] == "全部"?"":"?leix="+leix2[i]%>"
								style="margin: 0 20px"
								<%
									if (leix2[i].equals(r_leix)){
								%>
								class="active"
								<%
								} else if (leix2[i].equals("全部")) {
									if (r_leix == null){

								%>
								class="active"
								<%
										}
									}
								%>
						><%=leix2[i]%></a>
						<%
							}
						%>
					</div>

					<div class="z1-4">
						影院服务：
						<%
							String[] fuw2 = new String[]{"全部","改签","退票"};
							for (int i = 0;i<fuw2.length;i++){
						%>
						<a
								href="yingyuan.jsp<%=fuw2[i] == "全部"?"":"?fuw="+fuw2[i]%>"
								style="margin: 0 20px"
								<%
									if (fuw2[i].equals(r_fuw)){
								%>
								class="active"
								<%
								} else if (fuw2[i].equals("全部")) {
									if (r_fuw == null){

								%>
								class="active"
								<%
										}
									}
								%>
						><%=fuw2[i].equals("全部")?"全部":"可"+fuw2[i]%></a>
						<%
							}
						%>

					</div>



				</div>
				<div style="margin-left: 300px">
					<div class="v1">影院列表</div>
					<%
						rs = ps.executeQuery();
						while(rs.next()){
							int id = rs.getInt("id");
							String name = rs.getString("name");
							String pinp = rs.getString("pinp");
							String xzq = rs.getString("xzq");
							String leix = rs.getString("leix");
							String fuw = rs.getString("fuw");
							String jvli = rs.getString("jvli");
							String qian = rs.getString("qian");
							String dizhi = rs.getString("dizhi");
					%>
					<div class="v2">
						<div>
							<div class="v2-1"><%=name%></div>
							<div class="v2-2">地址：<%=dizhi%></div>
							<form action="" method="">
								<%if (fuw.equals("退票/改签")) {%>
								<input type="button" value="退票" class="v2-3"/>
								<input type="button" value="改签" class="v2-3"/>
								<%}else if (fuw.equals("退票")){%>
								<input type="button" value="退票" class="v2-3"/>
								<%}else if (fuw.equals("改签")){%>
								<input type="button" value="改签" class="v2-3"/>
								<%}%>
							</form>
						</div>

						<div style="display: flex;
						flex-direction: column;
						align-items: center;
						margin-right: 5%;"
						>
							<div class="v3">
								<span class="v3-1">&#165;<%=qian%></span> 起 <br> &nbsp;<%=jvli%> </br>
							</div>
							<div class="v4"><a href="xuanzuo.jsp?y_id=<%=id%>">选座购票</a></div>
						</div>

					</div>
					<%
						}
					%>
				</div>

			</div>

